package com.zq.learn.springbatch.quartz;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Task2
 *
 * @author ZhangQi
 * @date 2020/2/17
 */
@Component
@DisallowConcurrentExecution
public class Task2 implements Job {
  private Logger log= LoggerFactory.getLogger(Task2.class);

  @Override public void execute(JobExecutionContext jobExecutionContext)
    throws JobExecutionException {
    log.info("我是task2222 ，我将执行2s钟， 线程名字 == > {} , 现在时间为 == > {}", Thread.currentThread().getId(),new Date());
    try {
      Thread.sleep(2000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    System.out.println(".....");
    log.info("我是task2222，我已经执行完成了，线程名字 == > {} , 现在时间为 == > {}",Thread.currentThread().getId(),new Date());
  }

}
